#ifndef __TANK_H__
#define __TANK_H__
#include "Object.h"
#include "glm/glm.h"
#include "Model.h"
class Tank : public Object
{
private:
	float scale_factor;
	Model* model;
	float width;
	float height;
	float depth;
public:
	Tank(float x, float y, float z, float scale_factor, Model* model) : Object(x, y, z)
	{
		this->scale_factor = scale_factor;
		this->model = model;
		this->width = model->get_width() * scale_factor;
		this->height = model->get_height() * scale_factor;
		this->depth = model->get_depth() * scale_factor;

	}
	void DrawBbox()
	{
		float h = height;
		float d = depth;
		float w = width;

		glColor3f(1.0, 0, 1.0);

		glBegin(GL_QUADS);
			glVertex3f(-w/2, -h/2, -d/2);
			glVertex3f(-w/2, -h/2, d/2);
			glVertex3f(w/2, -h/2, d/2);
			glVertex3f(w/2, -h/2, -d/2);
		glEnd();

		glBegin(GL_QUADS);
			glVertex3f(-w/2, -h/2, -d/2);
			glVertex3f(-w/2, -h/2, d/2);
			glVertex3f(-w/2, h/2, d/2);
			glVertex3f(-w/2, h/2, -d/2);
		glEnd();

		glBegin(GL_QUADS);
			glVertex3f(-w/2, -h/2, -d/2);
			glVertex3f(w/2, -h/2, -d/2);
			glVertex3f(w/2, h/2, -d/2);
			glVertex3f(-w/2, h/2, -d/2);
		glEnd();

		glBegin(GL_QUADS);
			glVertex3f(-w/2, -h/2, d/2);
			glVertex3f(w/2, -h/2, d/2);
			glVertex3f(w/2, h/2, d/2);
			glVertex3f(-w/2, h/2, d/2);
		glEnd();

		glBegin(GL_QUADS);
			glVertex3f(w/2, -h/2, d/2);
			glVertex3f(w/2, h/2, d/2);
			glVertex3f(w/2, h/2, -d/2);
			glVertex3f(w/2, -h/2, -d/2);
		glEnd();

		glBegin(GL_QUADS);
			glVertex3f(-w/2, h/2, -d/2);
			glVertex3f(-w/2, h/2, d/2);
			glVertex3f(w/2, h/2, d/2);
			glVertex3f(w/2, h/2, -d/2);
		glEnd();
		                                                                                                                           
	}
	virtual void Draw()
	{
		Object::Draw();
		glPushMatrix();
		glTranslatef(get_x(), get_y(), get_z());
		glPushMatrix();
		glScalef(scale_factor, scale_factor, scale_factor);
		glmDraw(model->get_model(), GLM_SMOOTH);
		glPopMatrix();
		glPopMatrix();
		DrawBbox();
	}
	virtual void Update()
	{
	}
	virtual void NotifyObserver()
	{
	}
	virtual void AddObserver(Observer* pOb)
	{
	}
};

#endif